package com.xuecheng.base.exception;

import lombok.Data;

/**
 * @author 星河一叶Ck
 * @date 2025/4/19
 */

@Data
public class XueChengPlusException extends RuntimeException{
    private Integer errCode;
    private String errMessage;

    public XueChengPlusException () {
        super();
    }

    public XueChengPlusException (String errMessage) {
        super(errMessage);
        this.errMessage = errMessage;
    }

    public XueChengPlusException (Integer code, String errMessage) {
        super(errMessage);
        this.errCode = code;
        this.errMessage = errMessage;
    }

    public static void cast (String errMessage) {
        throw new XueChengPlusException(errMessage);
    }
    
    public static void cast(CommonError commonError) {
        throw new XueChengPlusException(commonError.getErrMessage());
    }

    public static void cast (Integer code, String errMessage) {
        throw new XueChengPlusException(code, errMessage);
    }
}
